From 7d18398eebe52da382a2d3255e6de8f49c5b9798 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 30 Oct 2015 01:15:57 -0400 Subject: [PATCH] color button: Add a style class Add a .color style class to differentiate this button from the normal ones. --- gtk/gtkcolorbutton.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c index 9b3e7bb1e8..0a61e74f66 100644 --- a/gtk/gtkcolorbutton.c +++ b/gtk/gtkcolorbutton.c @@ -51,6 +51,11 @@ * The #GtkColorButton is a button which displays the currently selected * color and allows to open a color selection dialog to change the color. * It is suitable widget for selecting a color in a preference dialog. + * + * # CSS nodes + * + * GtkColorButton has a single CSS node with name button. To differentiate + * it from a plain #GtkButton, it gets the .color style class. */ @@ -366,6 +371,7 @@ gtk_color_button_init (GtkColorButton *button) GtkColorButtonPrivate *priv; PangoLayout *layout; PangoRectangle rect; + GtkStyleContext *context; /* Create the widgets */ priv = button->priv = gtk_color_button_get_instance_private (button); @@ -404,6 +410,9 @@ gtk_color_button_init (GtkColorButton *button) G_CALLBACK (gtk_color_button_drag_data_received), button); g_signal_connect (button, "drag-data-get", G_CALLBACK (gtk_color_button_drag_data_get), button); + + context = gtk_widget_get_style_context (GTK_WIDGET (button)); + gtk_style_context_add_class (context, "color"); } static void -- 2.30.2